package com.blb.springboot.controller;

import com.blb.springboot.entity.StudentPro;
import com.blb.springboot.entity.User;
import com.blb.springboot.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @author lvtian
 * @date 2023/1/9 9:29
 */
@Controller
public class Hello {
    @Autowired
    private StudentPro studentPro;

    @ResponseBody
    @RequestMapping("/hello")
    public String Hello(){
        return "Helloddy!!"+studentPro;
    }

    @Autowired
    private UserMapper userMapper;

    @ResponseBody
    @RequestMapping("/user")
    public List<User> findAll(){
        return userMapper.selectList(null);
    }

    @RequestMapping("/who")
    public String Who(Model model){
        model.addAttribute("name", "陈宇航");
        return "hellothy";
    }
}
